#ifndef __SUBSYSTEM_ROT_BLOCK_BEHAVIOR_H__
#define __SUBSYSTEM_ROT_BLOCK_BEHAVIOR_H__

#include <set>
#include <mutex>
#include "Engine/Point3.hpp"
#include "SubsystemPollableBlockBehavior.hpp"

using namespace PocketSurvival::Engine;

namespace PocketSurvival
{
    class SubsystemTimeOfDay;
    class SubsystemTerrain;
    class SubsystemGameInfo;
    class SubsystemPickables;

    class IInventory;

    // 食物腐烂行为
    class SubsystemRotBlockBehavior : public SubsystemPollableBlockBehavior
    {
    protected:
        SubsystemTimeOfDay *m_timeOfDay;
        SubsystemTerrain *m_terrain;
        SubsystemGameInfo *m_gameInfo;
        SubsystemPickables *m_pickables;

        double m_lastRotTime;
        int32_t m_rotStep;
        bool m_isRotEnabled;

    protected:
        virtual void handleInventory(IInventory *inventory, int32_t damageCount);

    public:

        virtual void onPoll(int32_t value, int32_t x, int32_t y, int32_t z) override;

        virtual void update(float dt) override;
        virtual void load(const nlohmann::json& json) override;
        virtual void save(nlohmann::json& json) override;

        virtual SubLoadEchelon getLoadEchelon() override;
        virtual const std::string& getName() const override;

        virtual SubUpdateType getUpdateType() override;
    };
    
}

#endif
